The present invention relates generally to the field of audio signal processing, and more particularly to a method and apparatus for emulating a frequency modulation sound chip.
In the early days of personal computers, the quality of audio produced by computers was primitive at best. Initially, personal computers could only produce single frequency beeps. The industry responded to the lack of high quality audio with a frequency modulation (FM) scheme that could produce multi-frequency audio signals. While frequency modulation has been generally discarded by the computer industry in favor of newer computer audio formats, a large base of FM applications remains among users that must still be supported.
FIG. 1a is a block diagram of a computer 5 including a central processing unit (CPU) 10 and peripheral cards 18, 19 and 20. Normally, one of the peripheral cards is a prior art sound card 20. CPU 10 is typically in communication with the peripheral cards, including sound card 20, through a system bus, such as NuBus, PCI, ISA or EISA. An application written to run on CPU 10 may interact with memory on the peripheral cards.
FIG. 1b is a block diagram of the prior art sound card of FIG. 1a. Sound card 20 typically includes an FM sound chip 30, memory 31, a digital to analog converter 32 and an amplifier 33. Usually, an application utilizing the FM audio standard (not shown) running on CPU 10 would communicate directly with FM chip 30 on sound card 20. Two of the most common FM chips are Yamaha Corporation's OPL2 and OPL3 FM chips. The operation of the OPL2 and OPL3, and similar types of FM chips, is described in Yamaha's Application Manual for the OPL3, 1992, which is incorporated herein by reference for all purposes.
A feature of FM based sound cards is that an FM application typically need only write information to the FM chip 30 without further follow up. FM chip 30 receives the appropriate information from the FM application and produces the appropriate digital version of the sound. Digital to analog converter 32 converts the digital information into an analog audio signal. The audio signal is typically amplified by amplifier 33 before being sent to a speaker 34. Speaker 34 is typically a built-in speaker within computer 5, or an external speaker.
While FM chips have been useful in the computer industry by allowing software applications running on computers to create richer audio, the use of FM has waned. Advances in sound card technology have enabled computers to produce higher quality audio than those produced by FM. However, due to the large base of FM applications already in existence, sound cards must still support FM audio. Typically, the solution has been to include an FM chip on each sound card. The requirement of backward compatibility thus increases the cost and complexity of current sound cards.
FIG. 2 is an address memory map 40 of an FM chip 30. The address memory map may include two banks of registers, bank0 41 and bank1 42. FM chips produce sounds based upon operators, as discussed further herein. The FM application provides certain information to FM chip 30 about the frequency and envelope (amplitude) of the desired audio signal to be generated by each operator of FM chip 30. Thus, memory map 40 contains registers and bits for receiving frequency and envelope information about the various operators. These data elements will be referred to and described in detail in connection with the discussion of FIGS. 3 through 12b.
FM chip 30 can typically handle either 18 or 36 operators. Each bank of registers 41 and 42 corresponds to 18 operators. If FM chip 30 handles only 18 operators for purposes of backward compatibility with older FM sound chips, then only bank0 41 is available for use by the FM application. If FM chip 30 can handle 36 operators then both banks 41 and 42 can be used. As can be appreciated, an eighteen operator FM chip is a subset of a thirty-six operator FM chip. Thus, a thirty-six operator FM chip can operate in an eighteen operator mode. A full explanation of all the registers of the banks can be found in the application manuals for the specific FM chip, for example, Yamaha's Application Manual for its OPL3 FM chip.
FIG. 3 is a block diagram of an operator 59. Each operator 59 includes an oscillator 60 and an envelope generator 62. Registers in the address memory map 40 provide the needed frequency and envelope data for operator 59 to generate the appropriate audio signal. Each operator 59 is one of two operators in a voice 63. The attack rate 35, decay rate 36, sustain level 37, release rate 38, key scale level 43, key scale rate 77 and the total level 44 registers generally define the envelope of each operator. Referring back to FIG. 2, each operator has a corresponding set of envelope registers 35-38, 43, 77 and 44.
FIG. 4a depicts the attributes of a typical envelope. The key scale level 43 and total level 44 registers define an attenuation level 45 of the audio signal from 0 dB. The contents of key scale level register 43 is a variable which adjusts the attenuation according to the frequency of the operator output to reduce the amplitude of higher frequency components, while the value of the total level register 44 is typically a fixed number.
Attack rate 35 defines the rate of ascension of the audio signal from attenuation level 45 to 0 db. Decay rate 36 defines the rate of descent from 0 dB to the sustain level 37. Release rate 38 defines the rate of descent of the audio signal from sustain level 37. Key scale rate 77 adjusts the rates according to the frequency of the operator, making higher frequency components shorter in duration.
FIG. 4b is a timing signal of a key.sub.-- on bit of a voice 63 of which operator 59, whose output is depicted in FIG. 4a, is a part. The attack of the audio signal is triggered by the key.sub.-- on bit 46. Once the key.sub.-- on bit 46 of the voice is set, operator 59 begins generation of the envelope. The generation of the envelope proceeds from attack, decay and sustain until the key.sub.-- on bit 46 is reset. The envelope then begins to release according to the release rate 38. The key.sub.-- on bit 46 can be reset at any time during the generation of the envelope, i.e., the envelope will begin to release during the attack, decay or sustain if the key.sub.-- on bit 46 is reset during those intervals.
FIG. 5 is a typical output of a non-feedback operator. Sine generator 60 generates a sine wave based upon the frequency 47 and block 43 of the voice 63 that operator 59 is a part of, and the multiplier 49 of the operator 59. Frequency 47 is typically a ten bit value, broken up into two addresses. Frequency 47 defines the note to be played within a specified octave. The octave is defined by block 48. The frequency 47 and block 48 define the frequency of a voice 63, or operator pairs. The individual multiplier for each operator 59 defines the frequency ratios between the two operators of voice 63, based upon the frequency of voice 63.
Given a frequency for an operator, the output of an operator resembles an amplitude modulated signal. The operator audio signal output can be represented as O(t)=A.sub.o sin(.omega..sub.o t), where A.sub.o is the amplitude of the envelope, and .omega..sub.o is the frequency of the output of operator 59.
FIGS. 6a to 6f are different configurations of operators forming a number of different types of voices 63(0)-63(5). A typical voice 63 includes a pair of operators 59(0) and 59(1) in one of two configurations, additive or FM. In the additive configuration voice 63(0), the outputs of the operators 59(0) and 59(1) are simply added together, as seen in FIG. 6a.
In the FM configuration voice 63(1), as seen in FIG. 6b, the output of one operator 59(0) becomes another frequency input to the other operator 59(1). Typically, the first operator is called a modulator 59(0) and the second operator is called a carrier 59(1). The resulting output of the voice 63 is represented as FM(t)=A.sub.c sin(.omega..sub.c t+A.sub.m sin(.omega..sub.m t)). A.sub.c is the amplitude of the envelope of carrier 59(1) and .omega..sub.c is the frequency of carrier 59(1).
As suggested earlier, typically one of the operators in a voice can be used in a feedback mode. The feedback can have a variable gain, .beta., as set in feedback register 50. The resulting output of the feedback operator is O.sub.fb (t)=A.sub.o sin(.omega..sub.o t+.beta.O.sub.fb (t)). Thus, an FM voice with a feedback modulator would have the output FM(t)=A.sub.c sin(.omega..sub.c t+A.sub.m sin(.omega..sub.m t+.beta.O.sub.m (t))). As can be appreciated, voice 63 can produce an audio signal rich with a large number of harmonics. A voice with two operators is typically referred to as a melodic voice.
In another voice configuration, four operators can be utilized to produce a four operator voice. In the prior art FM chips, typically only four of the more commonly used four operator configuration voices 63(2)-63(5) are available, as seen in FIGS. 6c-6f. The outputs of the illustrated four operator voices can be determined by applying the operator and voice equations previously discussed. The operators of the illustrated examples of four operator voices are depicted as non-feedback operators, but as can be appreciated, the operators may be feedback operators in any suitable combination within the four operator voice.
Alternatively, a single operator can be utilized independently to provide an output. A single operator voice is typically referred to as a rhythm voice, however a rhythm voice may also utilize two operators in an FM configuration. FM chip 30 can be put into a rhythm mode by setting a rhythm bit 55 in address memory map 40. Rhythm mode allows three dual operator voice pairs of the FM chip to operate in rhythm mode. Normally, four single operator rhythm voices are paired within two dual operator additive voices, since each rhythm operator is not a separate voice which are summed as part of the final output. The third dual operator rhythm voice is a two operator voice typically in an additive configuration.
Four of the unique rhythm sounds that utilize the additive rhythm voices are snare drum, tom-tom, top cymbal and hi hat. The operator selected to produce one of the rhythm sounds receives a noise signal from a noise generator as the frequency input of the operator, except for tom-tom, which receives a sine wave. The envelope of the operator can be set by the user. The output is normally added to the other operator in the dual operator voice to fully utilize both operators of a dual operator additive voice. By way of example, a tom-tom operator is added to a hi hat operator to produce a combined voice of a tom-tom and hi-hat sounds. Snare drum 51, tom-tom 52, top cymbal 53 and hi hat 54 bits activate the appropriate operators.
The bass drum rhythmic sound normally utilizes a dual operator voice in an additive configuration. Typically, the bass drum rhythmic operators do not utilize a noise signal, but is more similar to a melodic voice in additive mode. Bass drum bit 56 activate the voice used to produce the bass drum voice.
In prior art FM chips the number of combinations of single operator voices, double operator voices, and four operator voices are limited. Typically, a thirty-six operator FM chip can only use its thirty-six operators to produce a limited combination of six four operator voices, eighteen melodic dual operator voices, four single operator rhythmic voices, and one dual operator rhythmic voice, any combination amounting to no more than thirty-six operators.
FIG. 6g depicts a typical block diagram of the resulting audio signal produced by FM chip 30. Typically, all the voices 63(0)-63(m), where m is the number of voices available in FM chip 30, are added together, whether single, dual, or four operator voices. The product of the voices is an audio signal, either monaural, stereophonic or quadraphonic. Typically, the audio signal is a pulse code modulated signal, which is later converted to an analog audio signal.
As can be appreciated, an FM application running on CPU 10 need only write the values of the various frequency and amplitude values to FM chip 30 and assert the appropriate key.sub.-- on bits 46 to produce a complex audio signal. Typically, the FM application need not read data back from FM chip 30, unless the FM application requires the use of one of two timers typically included within FM chip 30. Bits of register 72 are used to start the timers, mask the timer overflow bits, and reset the overflow bits.
To utilize the onboard timers of FM chip 30, the FM application need only write to registers timer1 57 and timer2 58 to set the counts for the timers. The FM application then polls timer1 and timer2 overflow bits 64 and 65 to determine whether the timers have triggered. A third timer overflow bit 66 is the logical or of timer1 64 and timer2 65 overflow bits.
Within the same address space as the timer overflow bits are version bits 67 and 68. The address space is referred to as a control status register 71. Initially, the FM application can read control status register 71 to determine what type of FM chip is available. That is, whether FM chip 30 has either eighteen or thirty-six operators. Additionally, the FM application has the option to use only eighteen operators of a thirty-six operator FM chip, or utilize all the operators. The FM application can typically set mode bit 69 to select full thirty-six operator mode.
As noted above, due to the large base of FM applications already in existence, new sound cards must still support FM audio. Typically, the solution has been to include an FM chip on each sound card. As can be appreciated from the foregoing, FM chips are complex and the number of computations necessary to generate a frequency modulated sound is considerable. The number of logic devices, or gates in a single semiconductor device, required to perform the computations is also large. Additionally, FM devices are task specific and cannot be used for purposes other than generating FM sounds. Thus, the cost of implementing FM synthesis in hardware to support older FM applications remains is a significant concern.
In the meantime, recent advances in computer systems and CPUs have dramatically increased the ability of computer systems to handle complex computations at faster speeds. Processing capability has increased so much :hat current computer systems are often times not fully utilized to their full potential when running legacy FM applications. The cost of a new sound card could be significantly reduced and efficiency gained if this increased processing capability could somehow be exploited to eliminate the need to include an FM chip on new sound cards.